public class Test {
    //在Java中，将程序执行过程中发生的不正常行为称为异常。
    public static void main(String[] args) throws CloneNotSupportedException{
        //System.out.println(10 / 0);
        /*
        算数异常：
        Exception in thread "main" java.lang.ArithmeticException: / by zero
	    at Test.main(Test.java:4)
         */

        //int[] array = {1,2,3,4,5};
        //System.out.println(array[100]);
        /*
        数组越界异常：
        Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 100
	    at Test.main(Test.java:11)
         */

        //int[] array2 = null;
        //System.out.println(array2.length);
        /*
        空指针异常：
        Exception in thread "main" java.lang.NullPointerException
	    at Test.main(Test.java:20)
         */


        //Person person = new Person();
        //Person person1 = (Person) person.clone();
        /*
        克隆的异常：
        Exception in thread "main" java.lang.CloneNotSupportedException: Person
        at java.lang.Object.clone(Native Method)
        at Person.clone(Test.java:44)
        at Test.main(Test.java:27)
         */

        test();
        /*
        栈溢出：这是一个错误
        Exception in thread "main" java.lang.StackOverflowError
        还有堆溢出
         */
    }


    /*
    Throwable 分为两中子类：Error和Exception
    Throwable类：
    public class Throwable implements Serializable {

    Error类：
    public class Error extends Throwable {

    Exception类：
    public class Exception extends Throwable {
     */

    public static void test(){
        test();
    }
}
class Person{
    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

}
